<?php

/**
 * FILE: vibe-widgets.php 
 * Created on Jul 16, 2012 at 7:31:20 AM 
 * Author: Mr.Vibe 
 * Credits: www.VibeThemes.com
 * Project: WordPress 
 * License: GPLv2
 */


add_action('widgets_init', create_function('', "register_widget('twitter_widget');"));

class twitter_widget extends WP_Widget {

	function vslider_widget() { 
	   
		$widget_ops = array( 'classname' => 'footer-col tweet', 'description' => 'Custom Twitter Widget{VibeLivre}' );
		$control_ops = array( 'width' => 200, 'height' => 250, 'id_base' => 'vslider-widget' );
		$this->WP_Widget( 'twitter-widget', 'Twitter Widget', $widget_ops, $control_ops );
	}

	function widget($args, $instance) {
		extract($args);

		echo $before_widget;
                    echo '<div id="tweets" class="footer-col tweet">';
			if (!empty($instance['title']))
				echo $before_title . $instance['title'] . $after_title;
                
    if (empty($instance['twitter_name']))
    {
        $instance['twitter_name']='vibethemes';
    }
    echo '</div>';
	echo $after_widget;
	}

	function update($new_instance, $old_instance) {
         $instance=$old_instance;
        /* Strip tags (if needed) and update the widget settings. */
		$instance['title'] = strip_tags( $new_instance['title'] );
		$instance['twitter_name'] = $new_instance['twitter_name'];
        return $instance;
	}

	function form($instance) { ?>
    
		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e("Title"); ?>:</label>
			<input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" style="width:95%;" /></p>
        <p><label><?php _e("vSlider Name"); ?>:</label>  <br />  
            <input id="<?php echo $this->get_field_id('twitter_name'); ?>" name="<?php echo $this->get_field_name('twitter_name'); ?>" value="<?php echo $instance['twitter_name']; ?>" style="width:95%;" />
            </p>

	<?php
	}
}
?>